<!DOCTYPE html>
<html>

<head>

    {include file="Public/header"}
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
        .radio-inline input[type=radio] {
            margin-top: 4px
        }
    </style>
</head>

<body style="color:#333;padding:3px;">
<!-- 标题 -->
<div class="page-heade">
    <h1 class="title_color">TI核销批量设置发票信息</h1>
</div>
<!-- 标题 -->
<div>
    <div action="" class="form-inline">
        <table class="table table-bordered bud_hei" style="margin-top:0">
            <tr>
                <td style="min-width: 120px;width: 120px">有无发票<span class="colorRed">*</span>：</td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="ionse" id="inlineRadio1" value="1">有发票
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="ionse" id="inlineRadio2" value="2">暂未开出，后补发票
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="ionse" id="inlineRadio3" value="0">不开发票且不补发票
                    </label>
                </td>
            </tr>
            <tr>
                <td style="min-width: 120px;width: 120px">发票号：</td>
                <td><input type="text" name="fapiaohao" id="fapiaohao" class="form-control"><a href="javascript:;">如何查看发票？</a></td>
            </tr>
            <tr>
                <td style="min-width: 120px;width: 120px">是否增票(可抵扣)<span class="colorRed">*</span> ：</td>
                <td>
                    <label class="radio-inline">
                        <input type="radio" name="ionsez" id="io1" value="1">是(可抵扣)
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="ionsez" id="io2" value="0">否(不可抵扣)
                    </label>
                    <a href="javascript:;">如何查看是否增票(可抵扣)?</a>
                </td>
            </tr>
            <tr>
                <td style="min-width: 120px;width: 120px">税率<span class="colorRed">*</span>：</td>
                <td><input type="text" name="shuilv" id="shuilv" class="form-control">% <a href="javascript:;">如何查看税率？</a></td>
            </tr>
            <tr>
                <td style="min-width: 120px;width: 120px">支付方式<span class="colorRed">*</span>：</td>
                <td>
                    <select name="zhifufangshi" id="zhifufangshi" class="form-control">
                        <option value="0">货补</option>
                        <option value="1">账扣</option>
                        <option value="2">现金</option>
                        <option value="3">转账</option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="row text-center padding-10">
            <button class="btn btn-success" id="querentijiao">确认提交</button>
            <button class="btn btn-warning" type="button" id="cancelBack">关闭返回</button>
        </div>
    </div>
</div>
{include file="Public/footer"}

<!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
<script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script>
    var cancelBack = document.getElementById('cancelBack')
    cancelBack.onclick = function () {
        parent.layer.closeAll();
    }

    $('#querentijiao').on('click',function () {
        if(parent.$('[name=items]:checked').length<1){
            parent.swal('请至少选择一条记录')
            return false
        }

        var iconse = $('[name=ionse]:checked').val()
        if(typeof iconse=='undefined'){
            parent.swal('请选择有无发票')
            return false
        }

        /*var iconse = $('[name=fabiaohao]').val()
        if(iconse==''){
            parent.swal('请填写发票号')
            return false
        }*/

        var ionsez = $('[name=ionsez]:checked').val()
        if(typeof ionsez=='undefined'){
            parent.swal('请选择是否增票')
            return false
        }

        var shuilv = $('[name=shuilv]').val()
        if(shuilv==''){
            parent.swal('请填写税率')
            return false
        }
        var zhifufangshi = $('[name=zhifufangshi]').val()
        if(zhifufangshi==''){
            parent.swal('请选择支付方式')
            return false
        }

        var fapiaohao = $('[name=fapiaohao]').val()
        parent.$('[name=items]:checked').each(function (ii,oo) {
            var tr = $(oo).closest('tr')

            tr.find('input.youwufapiao').each(function (i,o) {
                $(o).prop('checked',false)
                if($.trim($(o).val())==$.trim(iconse)){
                    $(o).prop('checked',true)
                }
            })

            tr.find('input[name=fapiaohao]').each(function (i,o) {
                $(o).val(fapiaohao)
            })

            //是否增值税
            tr.find('input.shizengzhishui').each(function (i,o) {
                $(o).prop('checked',false)
                if($.trim($(o).val())==$.trim(ionsez)){
                    $(o).prop('checked',true)
                }
            })


            tr.find('input[name=shuilv]').each(function (i,o) {
                $(o).val(shuilv)
            })
            tr.find('[name=zhifufangshi]').val(zhifufangshi)


        })
        parent.layer.closeAll();
    })
</script>
</body>

</html>